<template>
	<el-form ref="ruleFormRef" label-position="top" :model="formInline" :rules="formRules" label-width="auto"
		v-loading="isLoading">
		<el-row :gutter="30">

			<re-col :value='24' :xs='24' :sm='24'>
				<el-form-item :label='titles.protocolName' prop='protocolName'>
					<el-input :maxlength="30" :show-word-limit="true" v-model.trim='formInline.protocolName' clearable :placeholder='prompt.protocolName' />
				</el-form-item>
			</re-col>
			<re-col :value='24' :xs='24' :sm='24'>
				<el-form-item :label='titles.protocolContent' prop='protocolContent'>
					<el-input v-model.trim='formInline.protocolContent' clearable :placeholder='prompt.protocolContent'
						 show-word-limit  type="textarea"  :rows="20"/>
				</el-form-item>
			</re-col>
		</el-row>
	</el-form>
</template>

<script setup lang="ts">
import { ref, reactive } from "vue";
import ReCol from "@/components/ReCol";
import type { FormRules } from "element-plus";
import { titles, prompt } from './index';
import type { infoType } from '@/api/manage/product-management/gateway-protocol/index';
type FormProps = {
	formInline: infoType,
	isLoading: boolean
}

const props = withDefaults(defineProps<FormProps>(), {
	formInline: () => ({} as infoType),
	isLoading: false
});

const formRules = reactive(<FormRules>{
	protocolName: [{ required: true, message: prompt?.protocolName, trigger: 'blur' },],
	protocolContent: [{ required: true, message: prompt?.protocolContent, trigger: 'blur' },],

});
const ruleFormRef = ref();
function getRef() {
	return ruleFormRef.value;
}

defineExpose({ getRef });
</script>
